Create Virtual Machine #2
2011/03/06 |
Create a Virtual Machine from template. |
|
[1] | Create a Virtual Machine from template that is made in Create Virtual Machine #1. |
# copy disk image and XML file for a new Virtual Machine root@dlp:~# cp guest.img /var/kvm/images/mail.img root@dlp:~# cp guest.xml /etc/libvirt/qemu/mail.xml root@dlp:~# vi /etc/libvirt/qemu/mail.xml <domain type='kvm'> # change name <name> mail </name># change UUID generated above <uuid>44bc51c4-93ec-11df-99ae-0022683d8288</uuid> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <vcpu>2</vcpu> <os> <type arch='x86_64' machine='pc-0.12'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw'/> # change disk <source file='/var/kvm/images/ mail.img '/><target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> <interface type='bridge'> # remove the line for mac address <mac address='52:54:00:52:31:12'/> <source bridge='br0'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target port='0'/> </console> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </memballoon> </devices> </domain> root@dlp:~# virsh define /etc/libvirt/qemu/mail.xml # define new settings Domain mail defined from /etc/libvirt/qemu/mail.xml root@dlp:~# virsh start mail --console Domain mail started Connected to domain mail Debian GNU/Linux 6.0 www ttyS0 www login: # complete to boot root@www:~# vi /etc/hostname # change hostname you like mail root@www:~# logout Debian GNU/Linux 6.0 www ttyS0 mail login: # complete |